package cn.x.kindergarten.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.x.kindergarten.domain.Chengji;
import cn.x.kindergarten.service.ChengjiService;
import cn.x.kindergarten.util.Tools;


@Controller("chengjiController")
@RequestMapping("/chengji")
public class ChengjiController {
	@Resource(name="chengjiService")
	public ChengjiService chengjiService;

	@RequestMapping("/listChengji.action")
	public String listChengji(Model model){
		List<Chengji> chengjiList = this.chengjiService.queryAll();
		model.addAttribute("chengjiList", chengjiList);
		return "listChengji";
	}
	
	@RequestMapping("/addUI.action")
	public String addChengjiUI(){
		return "addChengjiUI";
	}
	
	@RequestMapping("/addChengji.action")
	public String addChengji(Chengji chengji){
		chengji.setCid("141215620d");
		this.chengjiService.insert(chengji);
		return "redirect:/chengji/listChengji.action";
	}
}
